package com.fengye.fdfs;

import lombok.Data;

/**
 * @author fengyexjtu@126.com
 * @date 2022年05月22日 6:52 PM
 */
@Data
public class Response<T> {
    private String message;
    private T data;

    private Response(String message) {
        this.message = message;
    }

    private Response(String message, T data) {
        this.message = message;
        this.data = data;
    }

    private Response() {
        new Response<>("请求成功");
    }

    public static Response<Object> OK() {
        return new Response<Object>("请求成功");
    }

    public static Response<Object> OK(String message) {
        return new Response<Object>(message);
    }

    public static Response<Object> OK(String message, Object data) {
        return new Response<Object>(message, data);
    }


    public static Response<Object> error() {
        return new Response<Object>("请求失败");
    }

    public static Response<Object> error(String message) {
        return new Response<Object>(message);
    }

    public static Response<Object> error(String message, Object data) {
        return new Response<Object>(message, data);
    }

}
